<?php

use Illuminate\Database\Seeder;
use Laravel\Passport\Client;
use Laravel\Passport\PersonalAccessClient;

class PassportSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Artisan::call('passport:keys');
        $client = (new Client)->forceFill([
            'id' => 591347864,
            'user_id' => null,
            'name' => 'Login Token',
            'secret' => '8pUS2KphWDBORD2Fy5HqhtdsSRnR5MZMGMCefxfm',
            'redirect' => env('APP_URL', 'http://localhost'),
            'personal_access_client' => false,
            'password_client' => true,
            'revoked' => false,
        ]);
        $client->save();
        $accessClient = new PersonalAccessClient();
        $accessClient->client_id = $client->id;
        $accessClient->save();

        $client = (new Client)->forceFill([
            'id' => 789244256,
            'user_id' => null,
            'name' => 'WeChat Token',
            'secret' => \Illuminate\Support\Str::random(40),
            'redirect' => env('APP_URL', 'http://localhost'),
            'personal_access_client' => true,
            'password_client' => false,
            'revoked' => false,
        ]);
        $client->save();
        $accessClient = new PersonalAccessClient();
        $accessClient->client_id = $client->id;
        $accessClient->save();
    }
}
